<template>
  <div class="teamList">
    <h2 class="title">{{ buildingAlias }}-{{ cityName }}</h2>
    <Tabs value="name1" @on-click="tabClick">
      <TabPane label="当前团队" name="name1">
        <div class="teamTop">
          <span> 共{{ this.pageData.total }}条数据 </span
          ><Button type="primary" @click="addPerson">添加人员</Button>
        </div>
        <div class="tab">
          <Table
            ref="TableHeight"
            :max-height="onresizeHeight"
            :columns="columns1"
            :data="data1"
          ></Table>
        </div>
        <!-- 分页 -->
        <div class="pagePublicStyle" v-show="pageData.total > 0">
          <Page
            :total="pageData.total"
            :current="pageData.current"
            :page-size-opts="pageData.pageSizeOpts"
            @on-change="pageOnChangeFun"
            @on-page-size-change="pageOnPageSizeChangeFun"
            show-elevator
            show-sizer
            show-total
          />
        </div>

        <!-- 添加配置弹出框 -->
        <Modal
          v-model="modal"
          title="添加人员"
          class="addModel"
          @on-cancel="modalCancel"
          width="600px"
        >
          <!-- <div class="dui">
            <span>运营策划：</span>
            <div class="duiSel">
              <Select
                v-model="operateVal"
                filterable
                :multiple="false"
                clearable
                placeholder="请选择人员"
                @on-query-change="remoteSel"
                @on-open-change="yunSel"
              >
                <Option
                  v-for="item in yunList"
                  :value="item.userId"
                  :key="item.userId"
                  >{{ item.userName }}</Option
                >
              </Select>
            </div>
          </div>
          <div class="dui">
            <span>线上顾问：</span>
            <div class="duiSel">
              <Select
                v-model="adviserVal"
                filterable
                :multiple="true"
                placeholder="请选择人员"
                @on-query-change="remoteSel"
                @on-open-change="guSel"
              >
                <Option
                  v-for="item in guList"
                  :value="item.userId"
                  :key="item.userId"
                  >{{ item.userName }}</Option
                >
              </Select>
            </div>
          </div>
          <div class="dui">
            <span>店长：</span>
            <div class="duiSel">
              <Select
                v-model="shopownerVal"
                filterable
                :multiple="false"
                clearable
                placeholder="请选择人员"
                @on-query-change="remoteSel"
                @on-open-change="dianSel"
              >
                <Option
                  v-for="item in dianList"
                  :value="item.userId"
                  :key="item.userId"
                  >{{ item.userName }}</Option
                >
              </Select>
            </div>
          </div> -->
          <div class="dui" v-for="(item, index) in roleList" :key="index">
            <span>选择人员：</span>
            <div class="duiSel">
              <Select
                v-model="item.roleName"
                filterable
                :multiple="false"
                clearable
                placeholder="请选择角色"
                @on-open-change="selectedOpen"
              >
                <Option
                  v-for="role in roles"
                  :value="role.roleName"
                  :key="role.roleId"
                  >{{ role.roleName }}</Option
                >
              </Select>
              <Select
                v-model="item.userName"
                filterable
                :multiple="checkoutName(item.roleName)"
                clearable
                placeholder="请选择人员"
                @on-open-change="yunSel(index)"
              >
                <Option
                  v-for="user in item.yunList"
                  :value="user.userId"
                  :key="user.userId"
                  >{{ user.userName }}</Option
                >
              </Select>
              <Icon
                size="20"
                class="IconAdd"
                @click="addRolesForSelected"
                color="#2d8cf0"
                type="md-add-circle"
              />
              <Icon
                size="20"
                v-if="index !== 0"
                @click="roleList.splice(index, 1)"
                class="IconAdd"
                color="red"
                type="md-close-circle"
              />
            </div>
          </div>
          <div slot="footer">
            <Button type="text" size="large" @click="modalCancel">取消</Button>
            <Button type="primary" size="large" @click="modalOk">确定</Button>
          </div>
        </Modal>

        <!-- 更换楼盘 -->
        <Modal
          v-model="modal1"
          title="更换楼盘"
          width="700"
          @on-cancel="modalCancel1"
          :mask-closable="false"
        >
          <div class="dui">
            <span>选择楼盘：</span>
            <div class="duiSel">
              <Select
                v-model="selCityVal"
                filterable
                clearable
                placeholder="请选择城市"
                :remote-method="remoteMethod1"
                :loading="loading1"
                @on-change="cityChoose"
                @on-clear="cityClear"
              >
                <Option
                  v-for="item in cityList"
                  :value="item.cityCode"
                  :key="item.cityCode"
                  >{{ item.cityName }}</Option
                >
              </Select>
              <Select
                v-model="selBuildingVal"
                clearable
                filterable
                @on-change="houseChoose"
                placeholder="请选择楼盘"
              >
                <Option
                  v-for="item in cityHouseList"
                  :value="item.buildingId"
                  :key="item.buildingId"
                  >{{ item.buildingAlias }}</Option
                >
              </Select>
            </div>
          </div>

          <div class="modalCon">
            <span>当前所属楼盘：</span>

            <div class="modalConSel">
              <Tag
                v-for="(item, index) in peopleHouseList"
                type="border"
                closable
                color="primary"
                @on-close="handleClose(item)"
                :key="index"
                >{{ item.buildingName }}-{{ item.cityName }}</Tag
              >
            </div>
          </div>
          <div class="houText">
            该员工服务的楼盘有：
            <span
              style="margin-left: 10px"
              v-for="(item, index) in peopleHouseList"
              :key="index"
              >{{ item.buildingName }}-{{ item.cityName }}</span
            >
          </div>
          <div slot="footer">
            <Button type="text" size="large" @click="modalCancel1">取消</Button>
            <Button type="primary" size="large" @click="modalOk1">确定</Button>
          </div>
        </Modal>
      </TabPane>
      <TabPane label="历史团队" name="name2">
        <div class="teamTop">
          <span> 共{{ this.pageData2.total }}条数据 </span>
        </div>
        <div class="tab">
          <Table
            ref="TableHeight"
            :max-height="onresizeHeight"
            :columns="columns2"
            :data="data2"
          ></Table>
        </div>
        <!-- 分页 -->
        <div class="pagePublicStyle" v-show="pageData2.total > 0">
          <Page
            :total="pageData2.total"
            :current="pageData2.current"
            :page-size-opts="pageData2.pageSizeOpts"
            @on-change="pageOnChangeFun2"
            @on-page-size-change="pageOnPageSizeChangeFun2"
            show-elevator
            show-sizer
            show-total
          />
        </div>
      </TabPane>
    </Tabs>
  </div>
</template>
<script>
import {
  getTeamList,
  getTeamListHistory,
  getUserList,
  getPeopleJoin,
  getPeopleExit,
  getCityList,
  getCityHouseList,
  getPeopleBuilding,
  getPeopleTeam,
  getPeopleMove,
  getAddUserBuildingRecord
} from "@/api/configure.js";
import { getCustomerList1 } from "@/api/customerManagement.js";
import { getRoleList } from "@/api/system_center";
import { getByAdviser } from "@/api/materialManagement";
export default {
  components: {},
  data() {
    return {
      buildingAlias: this.$route.query.buildingAlias,
      cityName: this.$route.query.cityName,
      userMess: JSON.parse(this.$tool.getStorage("userMess")),
      pageData: {
        total: 0,
        current: 1,
        rows: 10,
        pageSizeOpts: [10, 20, 30, 40, 50],
      },

      // 添加人员
      modal: false,

      operateVal: "",
      adviserVal: "",
      shopownerVal: "",
      fuShopownerVal: "",

      loading1: false,
      cityList: [],
      cityHouseList: [],

      yunList: [],
      guList: [],
      dianList: [],
      fuDianList: [],

      roleList: [{ userName: "", roleName: "" }],
      roles: [],

      //更换楼盘
      modal1: false,
      selCityVal: "",
      selBuildingVal: "",
      changeHousePeopleVal: "",
      peopleHouseList: [],
      delTeamUserId: [],

      cityPageData: {
        total: 0,
        page: 1,
        rows: 50,
        pageSizeOpts: [10, 20, 30, 40, 50],
      },
      housePageData: {
        total: 0,
        page: 1,
        rows: 50,
        pageSizeOpts: [10, 20, 30, 40, 50],
      },

      onresizeHeight: 0,
      columns1: [
        {
          title: "姓名",
          key: "userName",
          minWidth: 120,
          render: (h, params) => {
            return h("div", [
              h(
                "span",
                {
                  style: {
                    display: "inline-block",
                    width: "100%",
                    overflow: "hidden",
                    textOverflow: "ellipsis",
                    whiteSpace: "nowrap",
                  },
                  domProps: {
                    title: params.row.userName,
                  },
                },
                params.row.userName
              ),
            ]);
          },
        },
        {
          title: "工号 ",
          key: "workNo",
          minWidth: 120,
        },
        {
          title: "手机号",
          key: "phone",
          minWidth: 120,
        },
        {
          title: "角色",
          key: "roleNames",
          minWidth: 120,
          render: (h, params) => {
            return h("div", params.row.roleNames.join(","));
          },
        },
        {
          title: "添加时间",
          key: "createTime",
          minWidth: 120,
        },

        {
          title: "操作",
          key: "operation",
          width: 200,
          align: "center",
          render: (h, params) => {
            return h("div", [
              // h(
              //   "a",
              //   {
              //     on: {
              //       click: (e) => {
              //         e.stopPropagation();
              //         this.changeHouse(params.row); //点击事件
              //       },
              //     },
              //   },
              //   "更换楼盘"
              // ),
              h(
                "a",
                {
                  style: {
                    marginLeft: "10px",
                  },
                  on: {
                    click: (e) => {
                      e.stopPropagation();
                      this.delHousePerson(params.row); //点击事件
                    },
                  },
                },
                "移除"
              ),
            ]);
          },
        },
      ],

      data1: [],
      columns2: [
        {
          title: "姓名",
          key: "userName",
          minWidth: 120,
          render: (h, params) => {
            return h("div", [
              h(
                "span",
                {
                  style: {
                    display: "inline-block",
                    width: "100%",
                    overflow: "hidden",
                    textOverflow: "ellipsis",
                    whiteSpace: "nowrap",
                  },
                  domProps: {
                    title: params.row.userName,
                  },
                },
                params.row.userName
              ),
            ]);
          },
        },
        {
          title: "工号 ",
          key: "workNo",
          minWidth: 120,
        },
        {
          title: "手机号",
          key: "phone",
          minWidth: 120,
        },
        {
          title: "角色",
          key: "positionType",
          minWidth: 120,
          render: (h, params) => {
            return h(
              "div",
              params.row.positionType == 1
                ? "运营策划"
                : params.row.positionType == 2
                ? "店长"
                : params.row.positionType == 3
                ? "副店长"
                : params.row.positionType == 4
                ? "线上顾问"
                : ""
            );
          },
        },
        {
          title: "添加时间",
          key: "createTime",
          minWidth: 120,
        },
        {
          title: "调离时间",
          key: "exitTime",
          minWidth: 120,
        },
      ],
      data2: [],
      pageData2: {
        total: 0,
        current: 1,
        rows: 10,
        pageSizeOpts: [10, 20, 30, 40, 50],
      },

      assignPageData: {
        total: 0,
        current: 1,
        rows: 10,
        pageSizeOpts: [10, 20, 30, 40, 50],
      },
    };
  },
  methods: {
    tabClick(val) {
      console.log(val, "tab");
      if (val == "name2") {
        this.reTeamListHistory();
      }
    },
    //楼盘团队列表
    reTeamList() {
      let params = {
        buildingId: this.$route.query.buildingId,
        teamId: this.$route.query.teamId,
        page: this.pageData.current,
        rows: this.pageData.rows,
      };
      getTeamList(params)
        .then((res) => {
          console.log("楼盘团队人员列表", res);
          this.data1 = res.list;
          this.pageData.total = parseInt(res.total);
          console.log(this.data1, "this.data1");
        })
        .catch((err) => {
          this.$Message.error(err);
        });
    },
    //添加选择人员列表
    addRolesForSelected() {
      let flag = this.roleList.some((item) => !item.userName || !item.roleName);
      console.log(6666, flag);
      if (flag) return this.$Message.error("请填写完成再添加");
      this.roleList.push({ userName: "", roleName: "" });
    },
    //点击角色筛选人员
    selectedOpen() {
      this.roles = this.$tool.deepClone(this.rolesAll);
    },
    //判断是否多选
    checkoutName(name) {
      return name !== "运营策划" && name !== "店长";
    },
    //历史楼盘团队列表
    reTeamListHistory() {
      let params = {
        buildingId: this.$route.query.buildingId,
        teamId: this.$route.query.teamId,
        page: this.pageData2.current,
        rows: this.pageData2.rows,
      };
      getTeamListHistory(params)
        .then((res) => {
          console.log("历史楼盘团队人员列表", res);
          this.data2 = res.list;
          this.pageData2.total = parseInt(res.total);
        })
        .catch((err) => {
          this.$Message.error(err);
        });
    },

    // yunSel(val) {
    //   this.searchUser = val;
    //   this.reUserList();
    // },
    // guSel(val) {
    //   this.searchUser = val;
    //   this.reUserList();
    // },
    // dianSel(val) {
    //   this.searchUser = val;
    //   this.reUserList();
    // },
    // fuDianSel(val) {
    //   this.searchUser = val;
    //   this.reUserList();
    // },
    // resetSel(val) {
    //   this.searchUser = "";
    //   this.reUserList(val);
    // },
    yunSel(val) {
      this.reUserList(val);
    },

    guSel(val) {
      if (val) {
        this.searchUser = "";
        this.reUserList("gu");
      }
    },
    dianSel(val) {
      if (val) {
        this.searchUser = "";
        this.reUserList("dian");
      }
    },
    fuDianSel(val) {
      if (val) {
        this.searchUser = "";
        this.reUserList("fuDian");
      }
    },

    remoteSel(val) {
      console.log(val, "搜索");
      this.searchUser = val;
      this.reUserList();
    },

    //用户列表
    reUserList(index) {
      let mess = this.roleList[index],
        { roleName } = mess,
        roleId = this.rolesAll.find((item) => item.roleName == roleName).roleId,
        params = {
          roleId,
          searchKey: this.searchUser,
        };
      getByAdviser(params)
        .then((res) => {
          console.log("人员列表", res, index);
          mess.yunList = this.$tool.deepClone(res.list);
          this.roleList.splice(index, 1, mess);
          console.log(this.roleList);
        })
        .catch((err) => {
          console.log("错了", err);
        });
    },
    //角色列表
    getRoles(roleName = "") {
      getRoleList({ roleName, page: 1, rows: 50 }).then((res) => {
        console.log("角色列表", res);
        if (!roleName) this.rolesAll = this.$tool.deepClone(res.list);
        this.roles = res.list;
      });
    },
    //团队添加人员
    rePeopleJoin() {
      console.log(this.shopownerVal, " this.shopownerVal");
      let operationalPlanning,
        onLineAdviser = [],
        adviser = [],
        shopManager,
        appId = this.$tool.getStorage("appId");
      this.roleList.map((item) => {
        if (appId == 36) {
          Array.isArray(item.userName)
            ? (adviser = adviser.concat(item.userName))
            : adviser.push(item.userName);
        } else if (appId == 49) {
          if (item.roleName === "店长") shopManager = item.userName;
          else if (item.roleName === "运营策划")
            operationalPlanning = item.userName;
          else {
            if (Array.isArray(item.userName)) {
              onLineAdviser = onLineAdviser.concat(item.userName);
            } else {
              onLineAdviser.push(item.userName);
            }
          }
        }
      });
      let params = {
        buildingId: this.$route.query.buildingId,
        teamId: this.$route.query.teamId,
        createrId: this.userMess.userId,
        onLineAdviser, //线上顾问
        operationalPlanning, //运营策划
        shopManager, //店长
        adviser, //顾问
      };
      getPeopleJoin(params)
        .then((res) => {
          this.modalCancel();
          this.reTeamList();
        })
        .catch((err) => {
          this.$Message.error(err);
        });
    },

    //团队移除人员
    rePeopleExit(val) {
      let params = {

        teamUserId: val.teamUserId,
        teamId: val.teamId,
        createId: this.userMess.userId,
        userId: val.userId,
        positionType:val.positionType,

       fromBuildingId: this.$route.query.buildingId,
       fromBuildingNm:this.$route.query.buildingAlias,
      };
      getAddUserBuildingRecord(params)
        .then((res) => {
          this.modal = false;
          console.log("团队移除人员", res);
          // this.reTeamListHistory();
          this.reTeamList();
        })
        .catch((err) => {
          this.$Message.error(err);
        });
    },

    //  rePeopleExit(val) {
    //   let params = {
    //     teamUserId: val.teamUserId,
    //     teamId: val.teamId,
    //     createrId: this.userMess.userId,
    //     userId: val.userId,
    //   };
    //   getPeopleExit(params)
    //     .then((res) => {
    //       this.modal = false;
    //       console.log("团队移除人员", res);
    //       // this.reTeamListHistory();
    //       this.reTeamList();
    //     })
    //     .catch((err) => {
    //       this.$Message.error(err);
    //     });
    // },

    modalOk() {
      let flag,
        flag1,
        roleNames = [];
      this.roleList.map((item) => {
        if (!item.userName || !item.roleName) flag = true;
        flag1 = roleNames.indexOf(item.roleName) > -1;
        roleNames.push(item.roleName);
      });
      if (flag) return this.$Message.error("请完善人员选择");
      if (flag1) return this.$Message.error("选择角色不能重复，请修改");
      this.rePeopleJoin();
    },
    modalCancel() {
      this.modal = false;
      this.operateVal = "";
      this.adviserVal = "";
      this.shopownerVal = "";
      this.fuShopownerVal = "";
    },

    //城市列表
    reCityList() {
      let params = {
        userId: this.userMess.userId,
        level: 3,
        cityName: this.searchCityName,
        page: this.cityPageData.current,
        rows: this.cityPageData.rows,
      };
      getCityList(params)
        .then((res) => {
          this.loading1 = false;
          console.log("城市", res);
          this.cityList = res.list;
        })
        .catch((err) => {
          this.$Message.error(err);
        });
    },

    //城市
    cityChoose(val) {
      // this.selCityChooseVal = val;
      console.log(this.selCityVal, val, "我选择了城市");
      this.reCityHouseList();
      // this.remoteMethod1();
    },
    houseChoose(val) {
      // this.selBuildingChooseVal = val;
      // console.log(this.selBuildingChooseVal, "this.selBuildingChooseVal");
    },
    //城市模糊搜索
    remoteMethod1(val) {
      console.log(val, "1111111");
      if (val != "") {
        this.loading1 = true;
        this.searchCityName = val;
        this.reCityList();
      }
    },
    cityClear() {
      this.searchCityName = "";
      this.reCityList();
    },
    //根据城市楼盘列表
    reCityHouseList() {
      let params = {
        cityCode: this.selCityVal,

        page: this.housePageData.current,
        rows: this.housePageData.rows,
      };
      getCityHouseList(params)
        .then((res) => {
          console.log("根据城市楼盘列表", res);
          this.cityHouseList = res.list;
        })
        .catch((err) => {
          this.$Message.error(err);
        });
    },

    modalOk1() {
      if (this.selCityVal == "") {
        this.$Message.warning("请选择城市");
        return false;
      } else if (this.selBuildingVal == "") {
        this.$Message.warning("请选择楼盘");
        return false;
      } else {
        this.rePeopleMove();
      }
    },
    modalCancel1() {
      this.modal1 = false;
      this.delTeamUserId = [];
      this.selBuildingVal = "";
      this.selCityVal = "";
    },
    delHousePerson(val) {
      console.log(val, "楼盘移除员工");

      this.reCustomerList(val).then((len) => {
        console.log(len,'我是点了ok的len');
        if (len) {
          if(this.unlocking('客户管理', '5000031')){
            this.$Modal.confirm({
              title: "请先分配客户",
              content:
                "<p>" +
                val.userName +
                "名下仍有正在服务的客户，请先将TA的客户分配给其他顾问</p>",
              okText: "前往分配",
              cancelText: "取消",
              onOk: () => {
                
                this.$router.push({
                  path: "/customerManagement_center/allCustomers/assignCustomers",
                  query: {
                    userId: val.userId,
                    buildingId: this.$route.query.buildingId,
                    buildingAlias: this.$route.query.buildingAlias,
                  },
                });
                
              },
              onCancel: () => {
                this.$Message.info("你已经取消。");
              },
            });
          }else{
            this.$Modal.info({
              title: "请先分配客户",
              content:
                "<p>" +
                val.userName +
                "名下仍有正在服务的客户，请先将TA的客户分配给其他顾问</p>",
              okText: "知道了",              
            });
          }          
        } else {
          this.$Modal.confirm({
            title: "移除成员",
            content: `<p>确认将${val.userName}移除“${this.buildingAlias}”吗？<br/>移除后该成员将不再服务此项目</p>`,
            onOk: () => {
              this.rePeopleExit(val);
            },
            onCancel: () => {
              this.$Message.info("您已取消移除。");
            },
          });
        }
      });
    },

    //员工更换楼盘
    changeHouse(val) {
      console.log(val, "更换楼盘的人员信息");
      this.reCustomerList(val).then((len) => {
        if (len) {
          this.$Modal.confirm({
            title: "请先分配客户",
            content:
              "<p>" +
              val.userName +
              "名下仍有正在服务的客户，请先将TA的客户分配给其他顾问</p>",
            okText: "前往分配",
            cancelText: "取消",
            onOk: () => {
              this.$router.push({
                path: "/customerManagement_center/allCustomers/assignCustomers",
                query: {
                  userId: val.userId,
                  buildingId: this.$route.query.buildingId,
                  buildingAlias: this.$route.query.buildingAlias,
                },
              });
            },
            onCancel: () => {
              this.$Message.info("你取消了更换楼盘。");
            },
          });
        } else {
          this.modal1 = true;
          this.changeHousePeopleVal = val;
          this.reCityList(); //城市列表
          this.rePeopleTeam();
        }
      });
    },

    // 客户列表
    reCustomerList(val) {
      return new Promise((resolve, reject) => {
        let params = {
          buildingId: this.$route.query.buildingId,
          operateType: 1,
          userId: val.userId, //顾问id
          page: this.assignPageData.current,
          rows: this.assignPageData.rows,
          ifSubordinate: 2, //是否筛选下属客户
        };
        getCustomerList1(params)
          .then((res) => {
            console.log("获取客户列表", res);
            // this.len = res.total;
            console.log(res.total,'我是获取客户列表的len');
            resolve(Number(res.total));
          })
          .catch((err) => {
            this.$Message.error(err);
          });
      });
    },

    //人员所服务的楼盘的列表
    // rePeopleBuilding() {
    //   let params = {
    //     userId: this.changeHousePeopleVal.userId,
    //   };
    //   getPeopleBuilding(params)
    //     .then((res) => {
    //       console.log("人员所服务的楼盘的列表", res);
    //       this.peopleHouseList = res.list;
    //     })
    //     .catch((err) => {
    //       // this.$Message.warning(err);
    //       this.$Message.warning(err);
    //     });
    // },

    //人员所在的团队的列表
    rePeopleTeam() {
      let params = {
        userId: this.changeHousePeopleVal.userId,
      };
      getPeopleTeam(params)
        .then((res) => {
          console.log("人员所在的团队的列表", res);
          this.peopleHouseList = res.list;
        })
        .catch((err) => {
          // this.$Message.warning(err);
          this.$Message.error(err);
        });
    },

    //人员更换服务的楼盘
    rePeopleMove() {
      let params = {
        buildingId: this.selBuildingVal, //加入的楼盘id
        positionType: this.changeHousePeopleVal.positionType, //加入的职位分类
        userId: this.changeHousePeopleVal.userId, //人员id
        // exitTeamUserIds: this.delTeamUserId, //离开的楼盘id
      };
      if (this.delTeamUserId.length > 0) {
        params.exitTeamUserIds = this.delTeamUserId;
      } else {
        this.$Message.warning("请删除需要更换的楼盘。");
        return false;
      }
      getPeopleMove(params)
        .then((res) => {
          console.log("人员更换服务的楼盘", res);
          // this.peopleHouseList = res;
          this.modal1 = false;
          this.delTeamUserId = [];
          this.selBuildingVal = "";
          this.selCityVal = "";
          // this.reTeamListHistory();
          this.reTeamList();
        })
        .catch((err) => {
          this.$Message.error(err);
        });
    },

    addPerson() {
      this.modal = true;
      (this.roleList = [{ userName: "", roleName: "" }]), this.getRoles();
    },
    handleClose(val) {
      console.log(val, "移除楼盘1");
      this.peopleHouseList.forEach((item, index) => {
        if (item.buildingId == val.buildingId) {
          this.peopleHouseList.splice(index, 1);
          this.delTeamUserId.push(item.teamUserId);
        }
      });
      // console.log(ind,'ind')
      // this.peopleHouseList.splice(ind, 1);
      console.log(this.delTeamUserId, "this.peopleHouseList");
    },

    // 分页 页码改变事件
    pageOnChangeFun(page) {
      console.log("pageOnChangeFun", page);
      this.pageData.current = page;
      this.reTeamList();
    },
    // 分页 每页条数改变事件
    pageOnPageSizeChangeFun(page) {
      console.log("pageOnPageSizeChangeFun", page);
      this.pageData.rows = page;
      this.reTeamList();
    },

    // 分页 页码改变事件
    pageOnChangeFun2(page) {
      console.log("pageOnChangeFun2", page);
      this.pageData2.current = page;
      this.reTeamListHistory();
    },
    // 分页 每页条数改变事件
    pageOnPageSizeChangeFun2(page) {
      console.log("pageOnPageSizeChangeFun2", page);
      this.pageData2.rows = page;
      this.reTeamListHistory();
    },
  },
  computed: {},
  created() {
    this.reTeamList();
    // this.reTeamListHistory();
  },
  activated() {},
  deactivated() {},
  mounted() {
    window.onresize = () => {
      return (() => {
        setTimeout(() => {
          this.onresizeHeight =
            window.innerHeight - this.$refs.TableHeight.$el.offsetTop - 150;
        }, 10);
      })();
    };
  },
  watch: {
    // "$route"(to, from) {
    //   if(to.path == "######") {
    //     this.initData();
    //   }
    // }
  },
};
</script>
<style lang="scss" scoped>
.teamList {
  .title {
    padding: 8px 14px;
  }
  .teamTop {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding: 0 20px;
    line-height: 32px;
  }
}
/* page */
.pagePublicStyle {
  text-align: right;
  padding: 14px 0;
  margin-right: 30px;
}
.houseCurr {
  display: flex;
  flex-direction: row;
  margin-top: 10px;
  .currLabel {
    flex: 2;
    text-align: right;
  }
  .currList {
    flex: 9;
  }
}
.modalCon {
  display: flex;
  flex-direction: row;
  margin-top: 20px;
  & > span {
    flex: 2;
    text-align: right;
    line-height: 30px;
  }
  .modalConSel {
    flex: 9;
    /deep/.ivu-tag-border {
      line-height: 22px;
    }
  }
}
.houText {
  margin-top: 50px;
  text-align: center;
}
.dui {
  display: flex;
  flex-direction: row;
  margin-top: 10px;
  & > span {
    flex: 2;
    text-align: right;
    line-height: 30px;
  }
  .duiSel {
    display: flex;
    flex-direction: row;
    flex: 9;
  }
}
.IconAdd {
  float: right;
  margin: 6px;
}
.addModel {
  /deep/.ivu-select.ivu-select-single,
  .ivu-select-multiple {
    width: 230px;
  }
}
</style>
